home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Extras / Networking / SANA-II / slip_src / signal.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-17  |  11.6 KB  |  321 lines

  1. /*    @(#)signal.h 2.39 89/08/14 SMI; from UCB 6.7 85/06/08    */
  2.  
  3. /*
  4.  * Copyright (c) 1982 Regents of the University of California.
  5.  * All rights reserved.  The Berkeley software License Agreement
  6.  * specifies the terms and conditions for redistribution.
  7.  */
  8.  
  9. /*
  10.  * Copyright (c) 1987 by Sun Microsystems, Inc.
  11.  */
  12.  
  13. #ifndef    __sys_signal_h
  14. #define    __sys_signal_h
  15.  
  16. #include <vm/faultcode.h>
  17. #define    NSIG    32
  18.  
  19. /*
  20.  * If any signal defines (SIG*) are added, deleted, or changed, the same
  21.  * changes must be made in /usr/include/signal.h as well.
  22.  */
  23. #define    SIGHUP    1    /* hangup */
  24. #define    SIGINT    2    /* interrupt */
  25. #define    SIGQUIT    3    /* quit */
  26. #define    SIGILL    4    /* illegal instruction (not reset when caught) */
  27. #ifdef    vax
  28. #define        ILL_RESAD_FAULT    0x0    /* reserved addressing fault */
  29. #define        ILL_PRIVIN_FAULT    0x1    /* privileged instruction fault */
  30. #define        ILL_RESOP_FAULT    0x2    /* reserved operand fault */
  31. /* CHME, CHMS, CHMU are not yet given back to users reasonably */
  32. #endif    vax
  33. #ifdef    mc68000
  34. #define        ILL_ILLINSTR_FAULT    0x10    /* illegal instruction fault */
  35. #define        ILL_PRIVVIO_FAULT    0x20    /* privilege violation fault */
  36. #define        ILL_COPROCERR_FAULT    0x34    /* [coprocessor protocol error fault] */
  37. #define        ILL_TRAP1_FAULT    0x84    /* trap #1 fault */
  38. #define        ILL_TRAP2_FAULT    0x88    /* trap #2 fault */
  39. #define        ILL_TRAP3_FAULT    0x8c    /* trap #3 fault */
  40. #define        ILL_TRAP4_FAULT    0x90    /* trap #4 fault */
  41. #define        ILL_TRAP5_FAULT    0x94    /* trap #5 fault */
  42. #define        ILL_TRAP6_FAULT    0x98    /* trap #6 fault */
  43. #define        ILL_TRAP7_FAULT    0x9c    /* trap #7 fault */
  44. #define        ILL_TRAP8_FAULT    0xa0    /* trap #8 fault */
  45. #define        ILL_TRAP9_FAULT    0xa4    /* trap #9 fault */
  46. #define        ILL_TRAP10_FAULT    0xa8    /* trap #10 fault */
  47. #define        ILL_TRAP11_FAULT    0xac    /* trap #11 fault */
  48. #define        ILL_TRAP12_FAULT    0xb0    /* trap #12 fault */
  49. #define        ILL_TRAP13_FAULT    0xb4    /* trap #13 fault */
  50. #define        ILL_TRAP14_FAULT    0xb8    /* trap #14 fault */
  51. #endif    mc68000
  52. #ifdef    sparc
  53. #define        ILL_STACK        0x00    /* bad stack */
  54. #define        ILL_ILLINSTR_FAULT    0x02    /* illegal instruction fault */
  55. #define        ILL_PRIVINSTR_FAULT    0x03    /* privileged instruction fault */
  56. /* codes from 0x80 to 0xff are software traps */
  57. #define        ILL_TRAP_FAULT(n)    ((n)+0x80) /* trap n fault */
  58. #endif    sparc
  59. #define    SIGTRAP    5    /* trace trap (not reset when caught) */
  60. #define    SIGIOT    6    /* IOT instruction */
  61. #define    SIGABRT 6    /* used by abort, replace SIGIOT in the future */
  62. #define    SIGEMT    7    /* EMT instruction */
  63. #ifdef    mc68000
  64. #define        EMT_EMU1010        0x28    /* line 1010 emulator trap */
  65. #define        EMT_EMU1111        0x2c    /* line 1111 emulator trap */
  66. #endif    mc68000
  67. #ifdef    sparc
  68. #define        EMT_TAG        0x0a    /* tag overflow */
  69. #endif    sparc
  70. #define    SIGFPE    8    /* floating point exception */
  71. #ifdef    vax
  72. #define        FPE_INTOVF_TRAP    0x1    /* integer overflow */
  73. #define        FPE_INTDIV_TRAP    0x2    /* integer divide by zero */
  74. #define        FPE_FLTOVF_TRAP    0x3    /* floating overflow */
  75. #define        FPE_FLTDIV_TRAP    0x4    /* floating/decimal divide by zero */
  76. #define        FPE_FLTUND_TRAP    0x5    /* floating underflow */
  77. #define        FPE_DECOVF_TRAP    0x6    /* decimal overflow */
  78. #define        FPE_SUBRNG_TRAP    0x7    /* subscript out of range */
  79. #define        FPE_FLTOVF_FAULT    0x8    /* floating overflow fault */
  80. #define        FPE_FLTDIV_FAULT    0x9    /* divide by zero floating fault */
  81. #define        FPE_FLTUND_FAULT    0xa    /* floating underflow fault */
  82. #endif    vax
  83. #ifdef    mc68000
  84. #define        FPE_INTDIV_TRAP    0x14    /* integer divide by zero */
  85. #define        FPE_CHKINST_TRAP    0x18    /* CHK [CHK2] instruction */
  86. #define        FPE_TRAPV_TRAP    0x1c    /* TRAPV [cpTRAPcc TRAPcc] instr */
  87. #define        FPE_FLTBSUN_TRAP    0xc0    /* [branch or set on unordered cond] */
  88. #define        FPE_FLTINEX_TRAP    0xc4    /* [floating inexact result] */
  89. #define        FPE_FLTDIV_TRAP    0xc8    /* [floating divide by zero] */
  90. #define        FPE_FLTUND_TRAP    0xcc    /* [floating underflow] */
  91. #define        FPE_FLTOPERR_TRAP    0xd0    /* [floating operand error] */
  92. #define        FPE_FLTOVF_TRAP    0xd4    /* [floating overflow] */
  93. #define        FPE_FLTNAN_TRAP    0xd8    /* [floating Not-A-Number] */
  94. #ifdef    sun
  95. #define        FPE_FPA_ENABLE    0x400    /* [FPA not enabled] */
  96. #define        FPE_FPA_ERROR    0x404    /* [FPA arithmetic exception] */
  97. #endif    sun
  98. #endif    mc68000
  99. #ifdef    sparc
  100. #define        FPE_INTOVF_TRAP    0x1    /* integer overflow */
  101. #define        FPE_STARTSIG_TRAP    0x2    /* process using fp */
  102. #define        FPE_INTDIV_TRAP    0x14    /* integer divide by zero */
  103. #define        FPE_FLTINEX_TRAP    0xc4    /* [floating inexact result] */
  104. #define        FPE_FLTDIV_TRAP    0xc8    /* [floating divide by zero] */
  105. #define        FPE_FLTUND_TRAP    0xcc    /* [floating underflow] */
  106. #define        FPE_FLTOPERR_TRAP    0xd0    /* [floating operand error] */
  107. #define        FPE_FLTOVF_TRAP    0xd4    /* [floating overflow] */
  108. #endif    sparc
  109. #define    SIGKILL    9    /* kill (cannot be caught or ignored) */
  110. /*
  111.  * The codes for SIGBUS and SIGSEGV are described in <vm/faultcode.h>
  112.  */
  113. #define    SIGBUS    10    /* bus error */
  114. #define        BUS_HWERR    FC_HWERR    /* misc hardware error (e.g. timeout) */
  115. #define        BUS_ALIGN    FC_ALIGN    /* hardware alignment error */
  116. #define        BUS_OBJERR    FC_OBJERR    /* object returned errno value */
  117. /*
  118.  * The BUS_CODE(code) will be one of the above.  In the BUS_OBJERR case,
  119.  * doing a BUS_ERRNO(code) gives an errno value reported by the underlying
  120.  * file object mapped at the fault address.  Note that this appears to be
  121.  * duplicated with the segmentation fault case below -- unfortunate, since
  122.  * the specification has always claimed that such errors produce SIGBUS.
  123.  * The segmentation cases are left defined as a transition aid.
  124.  */
  125. #define        BUS_CODE(C)        FC_CODE(C)
  126. #define        BUS_ERRNO(C)    FC_ERRNO(C)
  127. #define    SIGSEGV    11    /* segmentation violation */
  128. #define        SEGV_NOMAP    FC_NOMAP    /* no mapping at the fault address */
  129. #define        SEGV_PROT    FC_PROT        /* access exceeded protections */
  130. #define        SEGV_OBJERR    FC_OBJERR    /* object returned errno value */
  131. /*
  132.  * The SEGV_CODE(code) will be SEGV_NOMAP, SEGV_PROT, or SEGV_OBJERR.
  133.  * In the SEGV_OBJERR case, doing a SEGV_ERRNO(code) gives an errno value
  134.  * reported by the underlying file object mapped at the fault address.
  135.  */
  136. #define        SEGV_CODE(C)    FC_CODE(C)
  137. #define        SEGV_ERRNO(C)    FC_ERRNO(C)
  138. #define    SIGSYS    12    /* bad argument to system call */
  139. #define    SIGPIPE    13    /* write on a pipe with no one to read it */
  140. #define    SIGALRM    14    /* alarm clock */
  141. #define    SIGTERM    15    /* software termination signal from kill */
  142. #define    SIGURG    16    /* urgent condition on IO channel */
  143. #define    SIGSTOP    17    /* sendable stop signal not from tty */
  144. #define    SIGTSTP    18    /* stop signal from tty */
  145. #define    SIGCONT    19    /* continue a stopped process */
  146. #define    SIGCHLD    20    /* to parent on child stop or exit */
  147. #define    SIGCLD    20    /* System V name for SIGCHLD */
  148. #define    SIGTTIN    21    /* to readers pgrp upon background tty read */
  149. #define    SIGTTOU    22    /* like TTIN for output if (tp->t_local<OSTOP) */
  150. #define    SIGIO    23    /* input/output possible signal */
  151. #define    SIGPOLL    SIGIO    /* System V name for SIGIO */
  152. #define    SIGXCPU    24    /* exceeded CPU time limit */
  153. #define    SIGXFSZ    25    /* exceeded file size limit */
  154. #define    SIGVTALRM 26    /* virtual time alarm */
  155. #define    SIGPROF    27    /* profiling time alarm */
  156. #define    SIGWINCH 28    /* window changed */
  157. #define    SIGLOST 29    /* resource lost (eg, record-lock lost) */
  158. #define    SIGUSR1 30    /* user defined signal 1 */
  159. #define    SIGUSR2 31    /* user defined signal 2 */
  160. /*
  161.  * If addr cannot be computed it is set to SIG_NOADDR.
  162.  */
  163. #define    SIG_NOADDR    ((char *)~0)
  164.  
  165. #if    !defined(KERNEL)  &&  !defined(LOCORE)
  166. void    (*signal())();
  167. /*
  168.  * Define BSD 4.1 reliable signals for SVID compatibility.
  169.  * These functions may go away in a future release.
  170.  */
  171. void  (*sigset())();
  172. int   sighold();
  173. int   sigrelse();
  174. int   sigignore();
  175. #endif    !KERNEL  &&  !LOCORE
  176.  
  177. #ifndef    LOCORE
  178. /*
  179.  * Signal vector "template" used in sigvec call.
  180.  */
  181. struct    sigvec {
  182.     void    (*sv_handler)();    /* signal handler */
  183.     int    sv_mask;        /* signal mask to apply */
  184.     int    sv_flags;        /* see signal options below */
  185. };
  186. #define    SV_ONSTACK    0x0001    /* take signal on signal stack */
  187. #define    SV_INTERRUPT    0x0002    /* do not restart system on signal return */
  188. #define    SV_RESETHAND    0x0004    /* reset signal handler to SIG_DFL when signal taken */
  189. /*
  190.  * If any SA_NOCLDSTOP or SV_NOCLDSTOP is change, the same
  191.  * changes must be made in /usr/include/signal.h as well.
  192.  */
  193. #define    SV_NOCLDSTOP    0x0008    /* don't send a SIGCHLD on child stop */
  194. #define    SA_ONSTACK    SV_ONSTACK
  195. #define    SA_INTERRUPT    SV_INTERRUPT
  196. #define    SA_RESETHAND    SV_RESETHAND
  197.  
  198. #define    SA_NOCLDSTOP    SV_NOCLDSTOP
  199. #define    sv_onstack sv_flags    /* isn't compatibility wonderful! */
  200.  
  201. /*
  202.  * Structure used in sigstack call.
  203.  */
  204. struct    sigstack {
  205.     char    *ss_sp;            /* signal stack pointer */
  206.     int    ss_onstack;        /* current status */
  207. };
  208.  
  209. /*
  210.  * Information pushed on stack when a signal is delivered.
  211.  * This is used by the kernel to restore state following
  212.  * execution of the signal handler.  It is also made available
  213.  * to the handler to allow it to properly restore state if
  214.  * a non-standard exit is performed.
  215.  */
  216. struct    sigcontext {
  217.     int    sc_onstack;        /* sigstack state to restore */
  218.     int    sc_mask;        /* signal mask to restore */
  219. #ifdef    vax
  220.     int    sc_sp;            /* sp to restore */
  221.     int    sc_fp;            /* fp to restore */
  222.     int    sc_ap;            /* ap to restore */
  223.     int    sc_pc;            /* pc to restore */
  224.     int    sc_ps;            /* psl to restore */
  225. #endif    vax
  226. #ifdef    mc68000
  227.     int    sc_sp;            /* sp to restore */
  228.     int    sc_pc;            /* pc to retore */
  229.     int    sc_ps;            /* psl to restore */
  230. #endif    mc68000
  231. #ifdef    sparc
  232. #define    SPARC_MAXREGWINDOW    31    /* max usable windows in sparc */
  233.     int    sc_sp;            /* sp to restore */
  234.     int    sc_pc;            /* pc to retore */
  235.     int    sc_npc;            /* next pc to restore */
  236.     int    sc_psr;            /* psr to restore */
  237.     int    sc_g1;            /* register that must be restored */
  238.     int    sc_o0;
  239.     int    sc_wbcnt;        /* number of outstanding windows */
  240.     char    *sc_spbuf[SPARC_MAXREGWINDOW]; /* sp's for each wbuf */
  241.     int    sc_wbuf[SPARC_MAXREGWINDOW][16]; /* window save buf */
  242. #endif    sparc
  243. #ifdef    sun386
  244.     int    sc_sp;            /* sp to restore */
  245.     int    sc_pc;            /* pc to retore */
  246.     int    sc_ps;            /* psl to restore */
  247.     int    sc_eax;            /* eax to restore */
  248.     int    sc_edx;            /* edx to restore */
  249. #endif
  250. };
  251. #endif    !LOCORE
  252.  
  253. #define    BADSIG        (void (*)())-1
  254.  
  255. /*
  256.  * If SIG_ERR, SIG_DFL, SIG_IGN, or SIG_HOLD are changed, the same changes
  257.  * must be made in /usr/include/signal.h as well.
  258.  */
  259. #define    SIG_ERR        (void (*)())-1
  260. #define    SIG_DFL        (void (*)())0
  261. #define    SIG_IGN        (void (*)())1
  262.  
  263. #ifdef    KERNEL
  264. #define    SIG_CATCH    (void (*)())2
  265. #endif    KERNEL
  266. #define    SIG_HOLD    (void (*)())3
  267.  
  268. /*
  269.  * Macro for converting signal number to a mask suitable for sigblock().
  270.  */
  271. #define    sigmask(m)    (1 << ((m)-1))
  272. /*
  273.  * signals that can't caught, blocked, or ignored
  274.  */
  275. #ifdef    KERNEL
  276. #define    cantmask        (sigmask(SIGKILL)|sigmask(SIGSTOP))
  277. #endif
  278.  
  279.  
  280. /*
  281.  * If SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK are changed, the same changes
  282.  * must be made in /usr/include/signal.h as well.
  283.  */
  284. #define    SIG_BLOCK        0x0001
  285. #define    SIG_UNBLOCK        0x0002
  286. #define    SIG_SETMASK        0x0004
  287.  
  288. #if    !defined(LOCORE) && !defined(KERNEL)
  289.  
  290. /*
  291.  * If changes are made to sigset_t or struct sigaction, the same changes
  292.  * must be made in /usr/include/signal.h as well.
  293.  */
  294. #include <sys/stdtypes.h>
  295.  
  296. struct    sigaction {
  297.     void         (*sa_handler)();
  298.     sigset_t    sa_mask;
  299.     int        sa_flags;
  300. };
  301.  
  302. /*
  303.  * If changes are made to the function prototypes, the same changes
  304.  * must be made in /usr/include/signal.h as well.
  305.  */
  306. void    (*signal())();
  307. int    kill(/* pid_t p, int sig */);
  308. int    sigaction(/* int signo,
  309.         struct sigaction *act, struct sigaction *oldact */);
  310. int    sigaddset(/* sigset_t *mask, int signo */);
  311. int    sigdelset(/* sigset_t *mask, int signo */);
  312. int    sigemptyset(/* sigset_t *mask */);
  313. int    sigfillset(/* sigset_t *mask */);
  314. int    sigismember(/* sigset_t *mask, int signo */);
  315. int    sigpending(/* sigset_t *set */);
  316. int    sigprocmask(/* int how, sigset_t *set, *oldset */);
  317. int    sigsuspend(/* sigset_t *mask */);
  318.  
  319. #endif    /* !LOCORE && !KERNEL */
  320. #endif    /* !__sys_signal_h */
  321.